import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CircleVO, CircleForm, CircleQuery } from '@/api/system/circle/types';

/**
 * 查询圈子列表
 * @param query
 * @returns {*}
 */

export const listCircle = (query?: CircleQuery): AxiosPromise<CircleVO[]> => {
  return request({
    url: '/system/circle/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询圈子详细
 * @param id
 */
export const getCircle = (id: string | number): AxiosPromise<CircleVO> => {
  return request({
    url: '/system/circle/' + id,
    method: 'get'
  });
};

/**
 * 新增圈子
 * @param data
 */
export const addCircle = (data: CircleForm) => {
  return request({
    url: '/system/circle',
    method: 'post',
    data: data
  });
};

/**
 * 修改圈子
 * @param data
 */
export const updateCircle = (data: CircleForm) => {
  return request({
    url: '/system/circle',
    method: 'put',
    data: data
  });
};

/**
 * 删除圈子
 * @param id
 */
export const delCircle = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/circle/' + id,
    method: 'delete'
  });
};
